import request from '@/utils/request.js'

/**
 * 获取文章分类
 * @returns
 */
export const articleGetChannelService = () => request.get('/my/cate/list')

/**
 * 添加
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const articleAddChannelService = (data) => request.post('/my/cate/add', data)

/**
 * 编辑文章分类
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const articleUpdateChannelService = (data) => request.put('/my/cate/info', data)

/**
 * 删除文章分类
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const articleDeleteChannelService = (id) =>
  request.delete('/my/cate/del', {
    params: {
      id
    }
  })

/**
 * 获取文章列表
 * @param params
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const artGetListService = (params) =>
  request.get('/my/article/list', {
    params
  })

/**
 * 发布文章
 * @param article
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const articlePubService = (article) => request.post('/my/article/add', article)

/**
 * 获取文章详情
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const articleGetDetailService = (id) =>
  request.get('/my/article/info', {
    params: {
      id
    }
  })

/**
 * 更新文章
 * @param article
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const articleUpdateService = (article) => request.put('/my/article/info', article)
